home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Sound / Cheap Studio / _headers / SimpleApp.h < prev   
Encoding:
C/C++ Source or Header  |  1996-11-15  |  19.8 KB  |  575 lines  |  [TEXT/CWIE]

  1. /*************************************************************************
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    Simple App Framework
  5. **
  6. **    by Matthew Xavier Mora, Apple Developer Technical Support mxmora@apple.com
  7. **
  8. **    File:        SimpleApp.h
  9. **
  10. **    Copyright © 1995-1996 Apple Computer, Inc.
  11. **    All rights reserved.
  12. **
  13. **    You may incorporate this sample code into your applications without
  14. **    restriction, though the sample code has been provided "AS IS" and the
  15. **    responsibility for its operation is 100% yours.  However, what you are
  16. **    not permitted to do is to redistribute the source as "DSC Sample Code"
  17. **    after having made changes. If you're going to re-distribute the source,
  18. **    we require that you make it clear in the source that the code was
  19. **    descended from Apple Sample Code, but that you've made changes.
  20. **
  21. **************************************************************************/
  22.  
  23. #include <Lists.h>
  24. #include <AppleEvents.h>
  25. #include <TextEdit.h>
  26.  
  27. #ifndef __SIMPLEAPP__
  28. #define __SIMPLEAPP__
  29.  
  30. /*---------------------------------------------------------------------------------- */
  31. #pragma mark Defines
  32. /*---------------------------------------------------------------------------------- */
  33. #define    kMagicSig                 (0x4D584D21)    /* 'MXM!' our magic signature */
  34. #define    kMaxMenus                 (20)
  35. #define    kMaxMenuItems             (128)
  36. #define    kMaxButtons             (128)
  37. #define    kMaxEventProcs             (10)
  38. #define    kAppleEventLoadingErr     (129)
  39. #define kScrollBarType            'scrl'
  40. #define    kEventPassThru             (true)        /* This lets the event pass thru to the default handler */
  41. #define    kEventOverRide             (false)        /* This overides the event and doesn't call to the default handler */
  42.  
  43. #define    kUpArrow                 (30)
  44. #define    kDownArrow                 (31)
  45. #define    kEnterKey                 (0x03)
  46. #define    kReturnKey                 (0x0D)
  47. #define    kTabKey                 (0x09)
  48.  
  49. #define    kAppleNum                 (128)
  50. #define    kFileNum                 (129)
  51. #define    kEditNum                 (130)
  52. #define    kMenuStartID             (127)
  53. #define    kMargin                 (5)
  54. #define    kUseStandardMenu         (true)
  55.  
  56. #define    kErrorBase                ( 0 )     //    Base value for SimpleApp Error Numbers
  57. #define    kSAStandardDebugAlert     ( 9999)
  58. #define    kSANonFatalError         ( kErrorBase )
  59. #define    kSAFatalError             ( kErrorBase - 1 )
  60. #define    kSABadSelectorErr        ( kErrorBase - 2 )
  61. #define    kSABadProcPtr            ( kErrorBase - 3 )    
  62. #define    kNotOurWindowError         ( kErrorBase - 4 )    
  63. #define    kNotValidObject            ( kErrorBase - 5 )
  64.     
  65. #define    kSAInObject             (1)
  66. #define    kSANotInObject             (2)
  67. #define    kSAObjectWasHit         (3)
  68. #define    kSAObjectWasNotHit         (4)
  69.  
  70. #define kSANoCommandKey         ( 0 )    // value for no command key equivalent
  71.  
  72. /*---------------------------------------------------------------------------------- */
  73. #pragma mark typedefs
  74. /*---------------------------------------------------------------------------------- */
  75. typedef            Str255 StringArray;
  76.  
  77. typedef            StringArray *StringArrayPtr,**StringArrayHandle ;
  78.  
  79. typedef            ControlRef ControlArray[];
  80. typedef            ControlArray *ControlArrayPtr,**ControlArrayHandle;        
  81.         
  82. typedef    struct    GroupRec             GroupRec,        *GroupRecPtr,        **GroupRecHandle;
  83. typedef    struct    ObjectItemRec         ObjectItemRec,    *ObjectItemRecPtr,    **ObjectItemRecHandle;
  84. typedef struct    MenuItemRec         MenuItemRec,    *MenuItemRecPtr ,    **MenuItemRecHandle ;
  85. typedef struct    ButtonItemRec         ButtonItemRec,    *ButtonItemRecPtr,    **ButtonItemRecHandle;
  86. typedef            ButtonItemRecHandle ButtonItemRef;
  87. typedef            ObjectItemRecHandle ObjectItemRef;
  88.  
  89. typedef pascal SInt16      (* MenuHitProc)      ( SInt32 modifiers);
  90. typedef pascal SInt16      (* MenuUpdateProc )    ( SInt32 modifiers);
  91. typedef pascal SInt16      (* ButtonHitProc)    ( ButtonItemRef me,SInt32 modifiers) ;
  92. typedef pascal SInt16      (* ButtonUpdateProc)( ButtonItemRef me,SInt32 modifiers);
  93. typedef pascal void       (* MyActionProc)    ( ControlHandle control,SInt16 part);
  94. typedef pascal Boolean     (* AboutProc)         ( SInt32 data);
  95.  
  96. typedef pascal Boolean     (* PreGroupHitProc)        (SInt32 modifiers ,Point pt, ControlArrayPtr cap , SInt16 count) ;
  97. typedef pascal SInt16     (* PostGroupHitProc)    ( SInt32 modifiers ,ControlRef cr,ButtonItemRecHandle brh, SInt16 item);
  98. typedef pascal SInt16     (* GroupUpdateProc)        ( WindowRef wind,GroupRecHandle grh );
  99.  
  100. typedef pascal SInt16     (*    WindowHitProc)        ( SInt32 modifiers);
  101. typedef pascal SInt16     (*    ListHitProc )        ( SInt32 modifiers) ;
  102. typedef pascal SInt16     (*    EditFieldHitProc)    ( SInt32 modifiers) ;
  103. typedef pascal SInt16     (*    WindowUpdateProc)    ( SInt32 modifiers) ;
  104. typedef pascal SInt16     (*    ListUpdateProc)        ( SInt32 modifiers) ;
  105. typedef pascal void         (*    ListDrawCellProc)    ( Point thecell, Rect *bounds ,ListRef listID );
  106. typedef pascal SInt16     (*    EditFieldUpdateProc)( SInt32 modifiers) ;
  107.  
  108. typedef pascal SInt16     (*    WindowIdleProc)        ( SInt32 modifiers ) ;
  109. typedef pascal SInt16     (*    ListIdleProc )        ( SInt32 modifiers ) ;
  110. typedef pascal SInt16     (*    EditFieldIdleProc)    ( SInt32 modifiers ) ;
  111. typedef pascal SInt16     (*    WindowGrowProc)        ( EventRecord *event );
  112. typedef pascal SInt16     (*    WindowZoomProc)        ( EventRecord *event );
  113. typedef pascal SInt16     (*    WindowActivateProc)    ( Boolean isActivating ) ;
  114.         
  115. typedef pascal SInt16     (*    TextFieldHitProc)    ( SInt32 modifiers) ;
  116. typedef pascal SInt16     (*    TextFieldUpdateProc)( SInt32 modifiers) ;
  117. typedef pascal SInt16     (*    EventProcs )        ( EventRecord *event) ;
  118. typedef pascal Boolean    (*    PreEventProc )         (EventRecord * event,long refCon);
  119. typedef pascal SInt16     (*    TerminateProc)        ( SInt32 flags) ;
  120. typedef pascal SInt16     (*    InitializeProc)        ( SInt32 flags) ;
  121. typedef pascal SInt16     (*    LowMemProc)            ( SInt32 flags ) ;
  122. typedef pascal SInt16     (*    MenuEventProc)        ( SInt32 menuResult);
  123. typedef pascal void         (*    WindowCloseProc)    ( WindowRef * theWindow);
  124.  
  125. /* generic object stuff */
  126. typedef pascal Handle    (* ObjectInitProc)        ( ObjectItemRecHandle orh);
  127. typedef pascal OSErr     (* ObjectDisposeProc)    ( ObjectItemRecHandle orh);
  128. typedef pascal SInt16     (* ObjectHitProc )         ( Point *pt,SInt32 modifiers, ObjectItemRecHandle me);
  129. typedef pascal SInt16     (* ObjectTrackProc )     ( Point *pt,SInt32 modifiers, ObjectItemRecHandle me);
  130. typedef pascal SInt16     (* ObjectUpdateProc)    ( WindowRef window, RgnHandle update,ObjectItemRecHandle me) ;
  131. typedef pascal void      (* ObjectKeyProc )        ( char keyCode, char theChar,SInt32 modifiers);
  132. typedef pascal void      (* ObjectIdleProc )        ( ObjectItemRecHandle orh);
  133. typedef pascal SInt16     (* ObjectEditProc )        ( ObjectItemRecHandle orh,SInt16 editAction);
  134.  
  135. /* Apple Event Stuff */
  136. typedef pascal OSErr     (* OpenDocProc )     ( AppleEvent *ae, AppleEvent * AEreply,SInt32 handlerRefcon);
  137. typedef pascal OSErr     (* OpenAppProc )     ( AppleEvent *ae, AppleEvent * AEreply, SInt32 handlerRefcon);
  138. typedef pascal OSErr     (* QuitAppProc )     ( AppleEvent *ae, AppleEvent * AEreply, SInt32 handlerRefcon);
  139. typedef pascal OSErr     (* PrintDocProc )     ( AppleEvent *ae, AppleEvent * AEreply, SInt32 handlerRefcon);
  140. typedef pascal SInt16     (* ScriptProc )     ( SInt16 resId);
  141.  
  142. typedef pascal OSErr     (* OpenFileProc)     (FSSpecPtr myFSSPtr);
  143. typedef pascal OSErr     (*    NewDocProc )     (long refCon);
  144.  
  145. struct MenuItemRec {
  146.     SInt16             menuID  ;
  147.     SInt16             menuItem  ;
  148.     Handle             menuObject  ;
  149.     MenuHitProc     menuHit  ;
  150.     MenuUpdateProc     menuUpdate  ;
  151. };
  152.  
  153. struct    GroupRec {
  154.     long                 groupType;
  155.     GroupRecHandle         nextGroup;
  156.     short                 groupID;
  157.     WindowRef             window ;
  158.     Str255                 groupTitle;
  159.     long                  groupRefCon;
  160.     short                 groupControlCount; 
  161.     StringArrayPtr         groupControlnames; 
  162.     Rect                 groupBounds ; 
  163.     short                 groupHSpacing;
  164.     short                 groupVSpacing ;
  165.     short                 groupFlags;
  166.     PreGroupHitProc     groupPreHit ; 
  167.     PostGroupHitProc     groupPostHit ; 
  168.     GroupUpdateProc     groupUpdate ;
  169.     ControlArrayPtr     groupControlArray;
  170. };
  171.             
  172. struct ButtonItemRec {
  173.     long                buttonType;
  174.     ButtonItemRef        nextButton  ;
  175.     SInt16                 buttonID  ;
  176.     ControlRef             buttonObject  ;
  177.     long                buttonRefCon;
  178.     GroupRecHandle        buttonGroup;
  179.     ButtonHitProc         buttonHit  ;
  180.     ButtonUpdateProc    buttonUpdate  ;
  181. };
  182.  
  183. struct ObjectItemRec {
  184.     long                objectType;
  185.     ObjectItemRef        nextObject;
  186.     SInt16                objectID;
  187.     Handle                objectHandle;
  188.     Str255                objectName;
  189.     Rect                objectRect;
  190.     UInt8                objectCmdKey;
  191.     WindowRef            objectOwner;
  192.     GroupRecHandle        objectGroup;
  193.     ObjectInitProc        objectInit;
  194.     ObjectDisposeProc    objectDispose;
  195.     ObjectHitProc        objectHit;
  196.     ObjectHitProc        objectTrack;
  197.     ObjectUpdateProc    objectUpdate;
  198.     ObjectIdleProc        objectIdle;
  199.     ObjectKeyProc        objectKey;
  200.     ObjectEditProc        objectEdit;
  201.     UInt32                objectRefCon;
  202.     UInt32                objectFlags;
  203.     SInt16                objectState;
  204. };
  205.  
  206. /*
  207.  
  208.                 buttonType:longint; 
  209.                 nextButton: ButtonItemRecHandle;
  210.                 buttonID: integer;
  211.                 buttonObject: ControlHandle;
  212.                 buttonRefCon    : longint;
  213.                 buttonGroup:GroupRecHandle;
  214.                 buttonHit: ButtonHitProc;
  215.                 buttonUpdate: ButtonUpdateProc;
  216.                 
  217.                 
  218. */
  219.  
  220. typedef struct     ScrollItemRec ScrollItemRec,*ScrollItemRecPtr, **ScrollItemRecHandle;    
  221.                 
  222. struct        ScrollItemRec {
  223.     SInt32 scrollType;
  224.     ScrollItemRecHandle nextScroll;
  225.     SInt16 scrollID;
  226.     ControlHandle scrollObject;
  227.     MyActionProc scrollHit;
  228.     MyActionProc scrollUpdate;
  229.     MyActionProc scrollIndicator;
  230.     MyActionProc scrollButton;
  231. };
  232.  
  233. struct PrintAreaRec {
  234.         Rect windowPrintRect  ;
  235.         SInt16 windowPrintHorz  ;
  236.         SInt16 windowPrintVert  ;
  237.         SInt16 windowPrintLineHeight  ;
  238.         SInt16 windowPrintMaxVert  ;
  239.         SInt16 windowPrintMargin  ;
  240. };
  241. typedef struct PrintAreaRec PrintAreaRec ,* PrintAreaRecPtr,**PrintAreaRecHandle;
  242.  
  243. typedef struct    ListItemRec ListItemRec,*ListItemRecPtr,**ListItemRecHandle ;
  244.  
  245. struct    ListItemRec {
  246.     ListItemRecHandle nextList  ;
  247.     ListRef listObject  ;
  248.     SInt16 listID  ;
  249.     ListHitProc listHit  ;
  250.     ListUpdateProc listUpdate  ;
  251.     ListIdleProc listIdle  ;
  252. };
  253.  
  254. typedef struct    EditFieldItemRec EditFieldItemRec,*EditFieldItemRecPtr,**EditFieldItemRecHandle ;
  255.  
  256. struct EditFieldItemRec {
  257.     EditFieldItemRecHandle nextEdit  ;
  258.     SInt16 editFieldID  ;
  259.     SInt32 editFieldFlags ;
  260.     TEHandle editFieldObject  ;
  261.     EditFieldHitProc editFieldHit  ;
  262.     EditFieldUpdateProc editFieldUpdate  ;
  263.     EditFieldIdleProc editFieldIdle  ;
  264. }; 
  265.  
  266.  
  267. enum { 
  268.         EditType,
  269.         ListType,
  270.           ButtonType
  271. } ;
  272. typedef SInt8 contentItemType;
  273.         
  274. struct    ContentRec {
  275.     SInt16 contentCount  ;
  276.     contentItemType kind  ;
  277.     union {
  278.         EditFieldItemRec efr  ;
  279.         ListItemRec lir  ;
  280.         ButtonItemRec bir ;         
  281.     };
  282. };
  283.  
  284. typedef struct     ContentRec ContentRec,*    ContentRecPtr;
  285.         
  286. typedef ContentRec WindowItemsArray[];
  287. typedef ContentRec * WindowItemsArrayPtr;
  288.  
  289. struct WindowItemRec {
  290.         SInt32                     windowMagic  ; /* Signature so we know our windows */
  291.         SInt16                     windowID  ;
  292.         WindowRef                 windowObject  ;
  293.         WindowHitProc             windowHit  ;
  294.         WindowUpdateProc         windowUpdate  ;
  295.         WindowIdleProc             windowIdle  ;
  296.         WindowGrowProc             windowGrow  ;
  297.         WindowActivateProc         windowActivate  ;
  298.         WindowCloseProc            windowClose;
  299.         WindowZoomProc            windowZoom;
  300.         PrintAreaRec             windowPrintAreaRec  ;
  301.         FSSpec                     windowFSSpec  ;
  302.         SInt16                   windowRefNum;
  303.         ListItemRecHandle         windowLists  ;
  304.         EditFieldItemRecHandle     windowEdits  ;
  305.         ButtonItemRecHandle     windowButtons  ;
  306.         ScrollItemRecHandle     windowScroll;
  307.         Boolean                 windowHasControls  ;
  308.         Boolean                 windowHasLists  ;
  309.         Boolean                 windowHasEditField  ;
  310.         SInt16                     windowItemCount  ;
  311.         WindowItemsArrayPtr     windowItems  ;
  312. };
  313. typedef struct WindowItemRec WindowItemRec, *WindowItemRecPtr,**WindowItemRecHandle;
  314.  
  315.         
  316. struct ProcTableRec {
  317.     EventProcs         EventProcsArray[kMaxEventProcs];
  318.     TerminateProc     Terminate ;
  319.     InitializeProc     Initialize;
  320.     LowMemProc         LowMem ;
  321.     MenuEventProc     MenuEvent ;
  322.     AboutProc         About;
  323.     OpenFileProc    openFile;
  324.     OpenDocProc     openDocAE ;
  325.     OpenAppProc     openAppAE;
  326.     QuitAppProc     quitAppAE;
  327.     PrintDocProc     printDocAE;
  328.     NewDocProc       newDoc;
  329. };
  330.  
  331.  
  332. #if __POWERPC__
  333.  
  334. #else
  335. #define gSACurrentWindow GSACURRENTWINDOW
  336. #define gSACurControl GSACURCONTROL
  337. #define gSAVPageSize GSAVPAGESIZE
  338. #define gSAHPageSize GSAHPAGESIZE
  339. #define gSAVLineSize GSAVLINESIZE
  340. #define gSAHLineSize GSAHLINESIZE
  341. #define gSAEvent     GSAEVENT
  342. #define gSAProcs    GSAPROCS
  343. #endif
  344.  
  345.  
  346. typedef struct ProcTableRec ProcTableRec, *ProcTablePtr;
  347. /*---------------------------------------------------------------------------------- */
  348. #pragma mark Globals
  349. /*---------------------------------------------------------------------------------- */
  350. extern    ListRef         gSAMyList  ;
  351. extern    SInt16             gSATerminateReason ;     /* When Quiting this tells us why we are quiting */
  352. extern    Boolean         gSADebug ;            /* Activate Debug Alerts. May make this an SInt16 */
  353.                                         /* for levels of debug */
  354. extern    ProcTableRec    gSAProcs  ;
  355. extern    Boolean         gOApped  ;
  356. extern    Boolean         gSADone  ;
  357. extern    Boolean         gSAHasAppleEvents  ;
  358. extern    Boolean         gSAHasTE  ;
  359. extern    Boolean         gSAHasList  ;
  360. extern    MenuRef         gSAAppleMenu  ;
  361. extern    MenuRef         gSAFileMenu  ;
  362. extern    MenuRef         gSAEditMenu  ;
  363. extern    EventRecord     gSAEvent  ;
  364. extern    Boolean         gSAHasControls  ;
  365. extern    WindowRef         gSACurrentWindow  ;
  366. extern    SInt16             gSADefaultFont  ;
  367. extern    SInt16             gsADefaultSize  ;
  368. extern    SysEnvRec         gSAMac  ;
  369. extern    WindowItemRecHandle gSACurWRecHandle  ;
  370. extern    SInt16             gSAWindowID  ;
  371. extern    TEHandle         gSACurTE  ;
  372. extern     ControlHandle     gSACurControl;
  373. extern    ListRef         gSACurList  ;
  374. extern     SInt16             gSACurrentItem;
  375.  
  376. /*---------------------------------------------------------------------------------- */
  377. #pragma mark Prototypes
  378. /*---------------------------------------------------------------------------------- */
  379.  
  380. pascal    SInt16    SAExecuteScript(SInt16 resID);
  381. pascal    void    SAMoveObject (ObjectItemRecHandle orh,SInt16 h,SInt16 v, Boolean reDraw);
  382. pascal    void    SADrawGroup(GroupRecHandle    grh,RgnHandle update);
  383.  
  384. pascal    void    InitSimpleApp (SInt16 masters ,  Boolean wantsStandardMenu);
  385. pascal    void    Run(void);
  386. pascal    void    CloseSimpleApp(void);
  387. pascal  void    SADoWindowClose(WindowRef * theWindow);
  388.  
  389. pascal    SInt16 DefaultMenuHit ( SInt32 modifiers);
  390.  
  391. pascal    SInt16 InstallFontMenu(SInt16 menuID,
  392.                                ConstStr255Param name,
  393.                               MenuHitProc menuHit,
  394.                               MenuUpdateProc menuUpdate);
  395.  
  396. pascal    SInt16 InstallMenu (SInt16 menuID,
  397.                             ConstStr255Param menuTitle,
  398.                             Boolean    Hierarchical,
  399.                             MenuHitProc    menuHit,
  400.                             MenuUpdateProc    menuUpdate );
  401.                                 
  402. pascal    SInt16 InstallResourceMenu (SInt16 menuID,
  403.                                     ConstStr255Param menuTitle,
  404.                                     OSType    resourceType,
  405.                                     SInt16    afterItem,
  406.                                     MenuHitProc    menuHit,
  407.                                     MenuUpdateProc    menuUpdate);
  408.  
  409. pascal    SInt16 InstallMenuItem (SInt16 menuID, 
  410.                                 SInt16 MenuItem,
  411.                                 ConstStr255Param menuTitle, 
  412.                                 UInt8 mark,
  413.                                 UInt8 cmdChar,
  414.                                 MenuHitProc menuHit,
  415.                                 MenuUpdateProc menuUpdate);
  416.  
  417. pascal    SInt16 InstallPushButton (SInt32 *buttonID,
  418.                                  WindowRef window,
  419.                                  ConstStr255Param name,
  420.                                  Rect *r,
  421.                                  UInt8 cmdKey,
  422.                                  ButtonHitProc bhp ,
  423.                                  ButtonUpdateProc bup  );
  424.                                  
  425. pascal     SInt16 InstallCustomObject (SInt32 * objectID,
  426.                                     WindowRef window ,
  427.                                     ConstStr255Param name ,
  428.                                     Rect * r ,
  429.                                     UInt8 cmdKey ,
  430.                                     ObjectInitProc oip ,
  431.                                     ObjectDisposeProc odp ,
  432.                                     ObjectHitProc ohp ,
  433.                                     ObjectTrackProc otp ,
  434.                                     ObjectUpdateProc oup ,
  435.                                     long refCon);
  436.                                     
  437. pascal SInt16 InstallControl (SInt32 * buttonID,
  438.                              WindowRef window,
  439.                              ConstStr255Param name,
  440.                              Rect *  r ,
  441.                              UInt8 cmdKey,
  442.                              SInt16 controlType,
  443.                              ButtonHitProc bhp ,
  444.                              ButtonUpdateProc bup );
  445.                              
  446. pascal SInt16 InstallCheckBox (SInt32 *buttonID,
  447.                              WindowRef window,
  448.                              ConstStr255Param name,
  449.                              Rect *  r ,
  450.                              UInt8 cmdKey,
  451.                              SInt16 initialValue, 
  452.                              ButtonHitProc bhp ,  /* set to nil for default checkbox action */
  453.                              ButtonUpdateProc bup );
  454.                              
  455. pascal    SInt16 InstallScrollBar (SInt32 * buttonID,
  456.                                  WindowRef window,
  457.                                  ConstStr255Param name,
  458.                                  Rect *r,
  459.                                  UInt8 cmdKey,
  460.                                  MyActionProc scrollHitProc ,
  461.                                  MyActionProc scrollButtonProc ,
  462.                                  MyActionProc  scrollIndicatorProc);
  463. pascal SInt16 InstallPopUp (long    *theButtonID,
  464.                             WindowRef window,
  465.                             ConstStr255Param name,
  466.                             Rect * r,
  467.                             SInt16 options,
  468.                             SInt16 styles,
  469.                             SInt16 MenuID,
  470.                             OSType resID,
  471.                             ButtonHitProc bhp, 
  472.                             ButtonUpdateProc bup 
  473.                             );                                 
  474. pascal SInt16 InstallRadioGroup (SInt16 theGroupID,
  475.                                 WindowRef window, 
  476.                                 SInt16 count, 
  477.                                 ConstStr255Param title,
  478.                                 StringArrayPtr names,
  479.                                 Rect * r, 
  480.                                 SInt16 defaultItem,
  481.                                 SInt16 hSpacing,
  482.                                 SInt16 vSpacing,
  483.                                 SInt16 buttonHeight,
  484.                                 SInt16 buttonWidth,
  485.                                 PreGroupHitProc PreGHP, 
  486.                                 PostGroupHitProc PostGHP, 
  487.                                 GroupUpdateProc gup );
  488.  
  489. pascal    SInt16 CreateDocumentWindow (ConstStr255Param name  ,
  490.                                     Rect * bounds  ,
  491.                                     Boolean visable );
  492. pascal void SAInitScripting(void);    
  493.                                 
  494. pascal    SInt16 GetDocumentWindow (  SInt16 resID);
  495.  
  496. pascal    void Print (Str255 s );                   /* Print no CR */
  497. pascal    void PrintLine (Str255 s);                /* Print with CR */
  498. pascal    void PrintTextHandle (Handle text  );     /* Print a buffer full of text with CR */
  499.  
  500. pascal    void SetRectLocation ( Rect *r,SInt16 h, SInt16 v);            /* This Sets a rects anchor point */
  501. pascal    void SetRectDimensions (Rect *r,SInt16 h, SInt16 v);            /* This Sets its size without changing its position */
  502.  
  503. pascal    void GetPrintArea (WindowRef window ,Rect * bounds );
  504. pascal    void SetPrintArea (WindowRef window, Rect * bounds );
  505.  
  506. pascal    EditFieldItemRecHandle SAGetEditField (WindowRef wind,SInt16 editID) ;
  507. pascal    void     SASetFocus (WindowRef theWindow, EditFieldItemRecHandle efrh);
  508. pascal    SInt16    AttachMenuToItem(SInt16 menuIDToAdd,SInt16 AttachMenuID,SInt16 AttachItem);
  509.  
  510. pascal    SInt16 InstallEditField (SInt32 * editID , 
  511.                                 WindowRef window,
  512.                                 ConstStr255Param name  ,
  513.                                 Rect * r,
  514.                                 EditFieldHitProc hitProc  ,
  515.                                 EditFieldUpdateProc updateProc  ,
  516.                                 ObjectKeyProc    keyProc    ,
  517.                                 SInt32 flags  );
  518.  
  519. pascal    SInt16 InstallList (SInt32 * listID  , 
  520.                             WindowRef window,
  521.                             Rect * r,
  522.                             ListHitProc lhp  , 
  523.                             ListUpdateProc lup  ,
  524.                             ListDrawCellProc ldcp  , 
  525.                             SInt32 flags );
  526.                             
  527. pascal SInt16     InstallPopUp(SInt32 *buttonID,
  528.                              WindowRef window,
  529.                              ConstStr255Param name,
  530.                              Rect *r,
  531.                              SInt16 options,
  532.                              SInt16 styles,
  533.                              SInt16 MenuID,
  534.                              OSType resID,
  535.                              ButtonHitProc bhp,
  536.                              ButtonHitProc bup);
  537.  
  538. pascal    SInt16 GetTEString (SInt16 editFieldID  ,ConstStr255Param s  ) ;
  539. pascal    OSErr AddStringToList (ListRef listID  ,ConstStr255Param s  );
  540.  
  541. pascal    void BlastString (SInt16 h, SInt16 v  ,Str255 s  ); /* These will blast text at the location specified. It erases as it draws */
  542. pascal    void BlastText (SInt16 h,SInt16 v  ,Handle text  );
  543. pascal    void InstallIdleProc(EventProcs  ip);
  544. pascal  void SetMyTitle(Str255 title);
  545. pascal  void SAEnableMe(void);
  546. pascal  void SADisableMe(void);
  547. pascal  void SAEnableObject(SInt32 thing);
  548. pascal  void SADisableMe();
  549. pascal     ButtonItemRecHandle SAGetGroupItem(WindowRef wind,SInt16 groupID,SInt16 item);
  550. pascal    SInt16 SADrawObject(ObjectItemRecHandle orh,RgnHandle update);
  551. pascal     SInt16 InstallStaticText(SInt32 * textID,WindowRef window,ConstStr255Param s ,Rect *r);
  552. pascal  void  ErrorMessage(ConstStr255Param msg,SInt32 error,SInt16 flags);
  553.  
  554. pascal    Handle SAGetObjectHandle(long thing);
  555.  
  556. pascal  void   SetWindowHitProc     (WindowRef window,WindowHitProc     theProc );
  557. pascal  void   SetWindowUpdateProc    (WindowRef window,WindowUpdateProc     theProc );
  558. pascal  void   SetWindowIdleProc    (WindowRef window,WindowIdleProc     theProc );
  559. pascal  void   SetWindowGrowProc    (WindowRef window,WindowGrowProc     theProc );
  560. pascal  void   SetWindowActivateProc(WindowRef window,WindowActivateProc theProc );
  561. pascal  void   SetWindowCloseProc     (WindowRef window,WindowCloseProc     theProc );
  562. pascal  void   SetWindowZoomProc     (WindowRef window,WindowZoomProc     theProc );
  563. pascal  void   SetWindowFSSpec         (WindowRef window,FSSpecPtr   FSSpec);
  564.  
  565. pascal     OSErr  GetWindowFSSpec         (WindowRef window,FSSpecPtr  theFSSpec );
  566. pascal    WindowCloseProc  GetWindowCloseProc (WindowRef window);
  567. pascal     void      SelectFile(void);
  568. pascal     void     SetOpenFileProc (OpenFileProc openFile);
  569. pascal  void InstallPreEventHandler (PreEventProc eventHandler,long refCon);
  570. pascal short SASetSleepValue(short sleep);
  571. pascal short SAInstallStandardDragHandlers(WindowRef window);
  572. pascal short SAAddWindowDragDataTypes(WindowRef window,OSType theType);
  573.  
  574. #endif    
  575.